<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<title>Log in</title>
		<link rel="stylesheet" type="text/css"href="./assets/css/log.css"/>
		<link rel="stylesheet" type="text/css"href="./assets/css/iconfont.css"/>
	</head>
	<body>
		<div id="app">
			<div id="login-box">
				<h1>账号注册</h1>
				<div class="input-box">
					<i class="iconfont">&#xe609;</i>
					<input v-model="account" type="text" placeholder="UserName" />
				</div>
				
				<div class="input-box">
					<i class="iconfont">&#xe605;</i>
					<input v-model="password" type="password" placeholder="UserPassword" />
				</div>
				
				<div class="input-box">
					<i class="iconfont">&#xe609;</i>
					<input v-model="power" type="text" placeholder="UserPower" />
				</div>
				<button v-on:click="register">Submit</button>
				<button onclick="window.location.href='login.html'" type="button">Return</a></button>
			</div>
		</div>
	</body>
	<script src="assets/js/vue.js"></script>
	<script src="assets/js/axios.min.js"></script>
	<script src="assets/js/const.js"></script>
	
	<script>
		var config={
			"el":"#app",
			"data":{
				"account":"",
				"password":"",
				"power":""
			},
			"methods":{
				register:function(){
					// http://localhost:9092/account/insertaccountById?accountAccount=admin2&accountPassword=123&accountPower=1
					var url = baseUrl+"/account/insertaccountById?"
					+"&accountAccount="+this.account
					+"&accountPassword="+this.password
					+"&accountPower="+this.power
					console.log(url);
					axios.get(url)
					.then(function(response){
						// window.alert("联网成功");
						var serverResult = response.data;
						var code = serverResult.code;
						if(code == 0){
							window.alert("注册成功!");
						}else{
							window.alert("注册失败!");
							//更新界面
							// this.vue.selectAllItem();
						}
					})
					.catch();
					
				}
			},
		}
		
		var vue = new Vue(config);
	</script>

</html>

